﻿using System.Diagnostics;

namespace LFSRecord2.Model.UserActions
{
    public class UserActionPropertyIsAnimatedChanged : UserActionBase
    {
        // Action description, so we can replay this action (and reverse it)
        public int LayerIndex { get; set; }
        public int PropertyIndex { get; set; }
        public bool IsAnimated { get; set; }

        public UserActionPropertyIsAnimatedChanged()
        {
            Action = UserActionTypes.PropertyIsAnimatedChanged;
        }

        public override void DoUndo()
        {
            Debug.WriteLine("Undoing a PropertyIsAnimatedChanged action");

            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].Initializing = true;
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].IsAnimated = !IsAnimated;
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].Initializing = false;
        
        }

        public override void DoRedo()
        {
            Debug.WriteLine("Redoing a PropertyIsAnimatedChanged action");

            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].Initializing = true;
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].IsAnimated = IsAnimated;
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].Initializing = false;
            
        }
    }
}
